<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Minimal and Clean Sign up / Login and Forgot Form by
	FreeHTML5.co</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Free HTML5 Template by FreeHTML5.co" />
<meta name="keywords"
	content="free html5, free template, free bootstrap, html5, css3, mobile first, responsive" />




<!-- Facebook and Twitter integration -->
<meta property="og:title" content="" />
<meta property="og:image" content="" />
<meta property="og:url" content="" />
<meta property="og:site_name" content="" />
<meta property="og:description" content="" />
<meta name="twitter:title" content="" />
<meta name="twitter:image" content="" />
<meta name="twitter:url" content="" />
<meta name="twitter:card" content="" />

<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="shortcut icon" href="favicon.ico">

<link
	href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300'
	rel='stylesheet' type='text/css'>

<link rel="stylesheet" href="bootstrapusers/css1/bootstrap.min.css">
<link rel="stylesheet" href="bootstrapusers/css1/animate1.css">
<link rel="stylesheet" href="bootstrapusers/css1/style3.css">

<!-- Modernizr JS -->
<script src="bootstrapusers/js1/modernizr-2.6.2.min.js"></script>
<!-- FOR IE9 below -->
<!--[if lt IE 9]>
	<script src="js/respond.min.js"></script>
	<![endif]-->

</head>
<body class="style-2">

	<div class="container">
		<div class="row">
			<div class="col-md-12 text-center">
				<ul class="menu">

				</ul>
			</div>
		</div>
		<div class="row">
			<div class="col-md-4 col-md-offset-4">


				<!-- Start Sign In Form -->
				<form action="" class="fh5co-form animate-box"
					data-animate-effect="fadeInLeft" id="registerForm">
					<h2>注 册</h2>

					<div class="form-group">
						<label for="name" class="sr-only">用户名</label> <input type="text"
							class="form-control" id="name" placeholder="用户名" name="username"
							autocomplete="off">
					</div>

					<div class="form-group">
						<label for="password" class="sr-only">密码</label> <input
							type="password" class="form-control" 
							placeholder="密码" id="userpwd" name="userpwd" autocomplete="off">
					</div>

					<div class="form-group">
						<label for="password" class="sr-only">确认密码</label> <input
							type="password" class="form-control" 
							placeholder="确认密码" id="cuserpwd" name="cuserpwd" autocomplete="off">
					</div>



					<div class="form-group">
						<label for="tel" class="sr-only">电话</label> <input type="tel"
							class="form-control" id="tel" placeholder="电话" name="usertel"
							autocomplete="off">
					</div>

					<div class="form-group">
						<input name="usersex" type="radio" checked="checked" value="男" />男
						<input name="usersex" type="radio" value="女" />女
					</div>
					<div class="form-group">
						<p>
							已经注册过了? <a href="login1">去登录</a>
						</p>
					</div>
					<div class="form-group">
						<input id="register" type="button" value="注册"
							class="btn btn-primary">
					</div>
				</form>
				<!-- END Sign In Form -->


			</div>
		</div>
		<div class="row" style="padding-top: 60px; clear: both;"></div>
	</div>

	<!-- jQuery -->
	<script src="bootstrapusers/js1/jquery.min.js"></script>
	<!-- Bootstrap -->
	<script src="bootstrapusers/js1/bootstrap.min.js"></script>
	<!-- Placeholder -->
	<script src="bootstrapusers/js1/jquery.placeholder.min.js"></script>
	<!-- Waypoints -->
	<script src="bootstrapusers/js1/jquery.waypoints.min.js"></script>
	<!-- Main JS -->
	<script src="bootstrapusers/js1/main.js"></script>

	<script type="text/javascript">
/* 		$(function(){
			
			if ($("#userpwd").value) {
				alert("密码不同，请重新输入");
				location.href = 'login1';
			}
			
			
			
		}) */
	
	
	
		$(function() {
	
			$("#register").click(function() {
				console.log($("#userpwd").val());
				console.log($("#cuserpwd").val());
				if ($("#userpwd").val()!=$("#cuserpwd").val()) {
		
					alert("密码不同，请重新输入");
 					location.href = "register";	
				}
				else{			
				
				$.ajax({
					url : "usersapi/register",
					type : "post",
					data : $("#registerForm").serialize(),
					dateType : 'json',
					success : function(data) {
						if(data.msg == "用户存在"){
							alert("用户名已存在，请更换用户名");
							location.href = "register";	
							
						}else if(data.msg == "注册成功") {
							alert("注册成功")
							location.href = 'login1'; //后台个人中心
						}

					},
				});
				};
			});
		})
	</script>



</body>
</html>